<?php 
header("content-type:text/html;charset=utf-8");
$pdo = new PDO("mysql:host=127.0.0.1;dbname=lx","root","root");
$sql = "select * from users";
$data = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
 ?>
 <!DOCTYPE html>
 <html>
 <head>
 	<title>展示界面</title>
 </head>
 <body>
 <center>
 	<table border="1">
 		<tr>
 			<td>用户名</td>
 			<td>密码</td>
 			<td>年龄</td>
 			<td>操作</td>
 		</tr>
 		<?php foreach ($data as $key => $value){ ?>
 			<tr>
 				<td><?php echo $value['name'] ?></td>
 				<td><?php echo $value['pwd'] ?></td>
 				<td><?php echo $value['age'] ?></td>
 				<td><a href="del.php?id=<?php echo $value['id'] ?>">删除</a></td>
 			</tr>
 		<?php } ?>
 		
 	</table>
 </center>
 </body>
 </html>